<?php
/**
 * CreateTime: 2024/1/22 11:02
 * User:LinQ
 */

namespace App\Http\Controllers\Goods;

use App\Http\Controllers\BasicInterfaceController;
use App\Http\Requests\Goods\GoodsTypeRequest;
use App\Http\Requests\System\ListRequest;
use App\Http\Service\Goods\ManageGoodsTypeService;

class ManageGoodsTypeController implements BasicInterfaceController
{

    public function getList()
    {
        $request = request()->only('page','page_size','filters','desc');
        (new ListRequest())->check($request);
        (new ManageGoodsTypeService())->getList($request);
    }

    public function getSelect()
    {
        (new ManageGoodsTypeService())->getSelect();
    }

    public function getSelectHasPage()
    {
        $request = request()->only('page','page_size','filters','desc');
        (new ListRequest())->check($request);
        (new ManageGoodsTypeService())->getSelectHasPage($request);
    }

    public function getInfo($id)
    {

    }

    public function create()
    {
        $data = request()->only(
            'goods_type_name',
                'pid'
        );

        (new GoodsTypeRequest())->check($data);
        (new ManageGoodsTypeService())->create($data);
    }

    public function fakeDelete($id)
    {

    }

    public function fakeDeleteByIds($ids)
    {

    }

    public function delete()
    {

    }

    public function update($id)
    {
        $data = request()->only('goods_type_name','pid');
        $data['goods_type_id'] = $id;
        (new ManageGoodsTypeService())->update($data);
    }
}
